package com.luke.exercise.mybatis;

import java.io.IOException;
import java.io.InputStream;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

public class Demo {

    public static void main(String[] args) throws IOException {
        String resource = "com/luke/mybatis/mybatis-config.xml";
        InputStream inputStream = Resources.getResourceAsStream(resource);
        SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);
        SqlSession session = sqlSessionFactory.openSession();
        session.selectOne("",1);
        
        TrdOperationLogMapper mapper = session.getMapper(TrdOperationLogMapper.class);
        TrdOperationLogEntity entity = mapper.selectLog(20001L);
        System.out.println(entity.toString());
        session.close();
    }
}
